$('#allmap').css('height', '670px');
$('#allmap').css('overflow', 'hidden');
//水宝贝隐藏显示
$(".szbb").click(function () {
    $(".show-hide").toggle(100);
});

//菜单移动效果
$(".gis_nav li").hover(function () {
    $(this).find('img').attr("height", "55px");
}, function () {
    $(this).find('img').attr("height", "48px");
});
//菜单点击切换
$(".gis_nav li").click(function () {
    $(".show-hide").show();
    var i = $(this).index();
    $(".szsjxx").hide();
    $(".gis_bg").hide();
    $(".gis_bg").eq(i).show();

    //if ($("#gis_ditu"+i).length > 0) {
    //$(".ifme").hide(); 
    //$(".ifme").eq(i).show();
    //}else {
    //$(".ifme").hide();      
    //$("#allmap").append('<iframe id="gis_ditu'+ i +'" runat="server" class="ifme" name="gis_ditu'+i+'" src="../prj_js/gis_'+i+'.html" width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe>')          
    //}
});

//全市菜单隐藏显示
$(".szsjxx_nav li").click(function () {
    $(this).addClass("li_on");
    $(this).nextAll().removeClass("li_on");
    $(this).prevAll().removeClass("li_on");
    var i = $(this).index();
    $(".szsjxx_xqpjyl").hide();
    $(".szsjxx_xqpjyl").eq(i).show();

})
//获取滚动条宽度
var gdt = getScrollWidth();
function getScrollWidth() {
    var noScroll, scroll, oDiv = document.createElement("DIV");
    oDiv.style.cssText = "position:absolute; top:-1000px; width:99px; height:99px; overflow:hidden;";
    noScroll = document.body.appendChild(oDiv).clientWidth;
    oDiv.style.overflowY = "scroll";
    scroll = oDiv.clientWidth;
    document.body.removeChild(oDiv);
    return noScroll - scroll;
}
//全市平均降雨量
function qsjy_btn() {
    $(".ifme").hide(); //地图隐藏
    $(".ifme").eq(0).show();//第一张地图显示
    // body... 
}
$("#qspjjyl").append('<p class="tb_zzjz" style="text-align: center;">正在加载数据......</p>')
//数据get
$.get("../../Home/GetPingJunYuLiang", "", function (data) {
    bindtaba_qspjjyl(data);
    gis_ditu0.window.addlele(data);
}, "json");
function bindtaba_qspjjyl(data) {

    var div_w = (2 * 100) + gdt;//全市DIV宽度
    $("#qspjjyl").css('width', div_w);
    $("#qspjjyl").find('.tb_zzjz').remove();
    data = JSON.parse(data);
    var table = document.getElementById("qspjjyl");
    for (var j = table.rows.length - 1 ; j >= 1; j--) {
        table.deleteRow(j);
    }
    //循环添加表格
    for (var i = 0; i < data.length; i++) {
        var list1 = data[i].ATCUNIT;
        var list2 = data[i].SUMRAIN / data[i].NUMRAIN;
        list2 = list2.toFixed(1) + "mm";

        var tr = table.insertRow(table.rows.length);

        var td1 = tr.insertCell(tr.cells.length);
        td1.innerHTML = list1;
        var td2 = tr.insertCell(tr.cells.length);
        td2.innerHTML = list2;
    }
    tr_btn2();
};

//全市评价降雨量详情
$(".szsjxx_xqpjyl_xq_div").append('<p class="tb_zzjz" style="text-align: center;">正在加载数据......</p>');
$.get("../../Home/GetPingJunYuLiangdetail", "", function (data) {
    bindtaba_qspjjyl_xq(data);
    gis_ditu0.window.jryl(data);
}, "json");


function bindtaba_qspjjyl_xq(data) {
    $(".szsjxx_xqpjyl_xq_div").find('.tb_zzjz').remove();
    data = JSON.parse(data);
    var aa = [];
    for (var i = 0; i < data.length; i++) {
        var list1 = data[i].ATCUNIT;

        aa[i] = list1;

        //var tr = table.insertRow(table.rows.length);

        //var td1 = tr.insertCell(tr.cells.length);
        //td1.innerHTML = list1;           
    };
    var bb = uniqueArray(aa);
    var _width = (bb.length * 200) + "px";
    $(".cshd_nav_xq").css('width', _width);
    $(".cshd_nav_xq_2").css('width', _width);
    $(".qspjylxq_box").css('width', _width);

    for (i = 0; i < bb.length; i++) {
        var list1_ = "<li style='width:200px; overflow:hidden;border-right:none'><div style='width:199px;border-right:1px solid #9c9c9c;'>" + bb[i] + "</div></li>";
        $(".cshd_nav_xq").append(list1_);
    }
    //循环添加表格       
    for (var i = 0; i < bb.length; i++) {
        var tab = "<table width:'100%' class='clearfix qspjjylxq_tab qspjjyl_xq" + i + "' style='float: left; width:200px; height:240px;' border='0' cellspacing='0' cellpadding='0'></table>";

        $(".qspjylxq_box").append(tab);
        var pj = "";
        var gs = 0;
        var pjyl = "";
        for (j = 0; j < data.length; j++) {
            if (data[j].ATCUNIT == bb[i]) {
                var _list1 = data[j].STNM;
                var _list2 = data[j].SUMVAL;
                var b = Number(_list2)
                pj = Number(pj)
                pj += b;
                gs++;
                var tr = "<tr><td>" + _list1 + "</td><td>" + _list2.toFixed(1) + "mm</td></tr>"
                $(".qspjjyl_xq" + i).append(tr)
            }
        };
        pjyl = pj / gs;
        var _pj = "<li style='width:200px; overflow:hidden;border-right:none'><div style='width:199px;border-right:1px solid #9c9c9c;'>" + pjyl.toFixed(1) + "mm</div></li>";
        $(".cshd_nav_xq_2").append(_pj);
        $(".qspjjyl_xq" + i + " tr:even").addClass("tr_b");
        $(".qspjjyl_xq" + i + " tr:odd").addClass("tr_b1");
    };
    tr_btn2();
    tb_box();
};





//城市河道查询
$("#cshd").append('<p class="tb_zzjz" style="text-align: center;">正在加载数据......</p>')
//if ($("#gis_ditu1").length == 0) {$("#allmap").append('<iframe id="gis_ditu1" runat="server" class="ifme" name="gis_ditu1" src="" width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe>');          }
function cshd_btn() {

    $(".ifme").hide();
    $(".ifme").eq(1).show();
    //$("#gis_ditu1").attr('src', '../prj_js/gis_1.html');
    $.get("../../Home/GetChengShihedao", "", function (data) {
        bindtaba_cshd(data);
        gis_ditu1.window.addlele(data,60,60);
    }, "json");

    function bindtaba_cshd(data) {
        var div_w = (4 * 100) + gdt;//城市河道div宽带
        $("#cshd").css('width', div_w);
        $("#cshd").find('.tb_zzjz').remove();
        data = JSON.parse(data);
        var table = document.getElementById("cshd");
        for (var j = table.rows.length - 1 ; j >= 0; j--) {
            table.deleteRow(j);
        }
        //遍历添加TD
        for (var i = 0 ; i < data.length; i++) {
            var list1 = "<div style='width:99px;'>" + data[i].monitoring_point_name + "</div>";
            var list2 = "";
            var list3 = "";
            var list4 = "";
            var _a = data[i].Z.toFixed(2);
            var _b = data[i].oldZ;
            if (_a > _b) {
                list2 = "<div style='width:99px;'>涨</div>";
            }
            else if (_a == _b) {
                list2 = "<div style='width:99px;'>平</div>";
            }
            else {
                list2 = "<div style='width:99px;'>落</div>";
            }
            var _c = data[i].flag;
            if (_c == 1) {
                list3 = "<div style='width:99px;'><span style='color:#FF7F00;'>预警</span></div>";
            }
            else if (_c == 2) {
                list3 = "<div style='width:99px;'><span style='color:#FF0000;'>报警</span></div>";
            }
            else {
                list3 = "<div style='width:99px;'><span style='color:#09F709;'>正常</span></div>";
            }
            list4 = "<div style='width:99px;'>" + _a + "</div>";
            var tr = table.insertRow(table.rows.length);

            var td1 = tr.insertCell(tr.cells.length);
            td1.innerHTML = list1;

            //添加水位列
            var td4 = tr.insertCell(tr.cells.length);
            td4.innerHTML = list4;

            var td2 = tr.insertCell(tr.cells.length);
            td2.innerHTML = list2;
        
            var td3 = tr.insertCell(tr.cells.length);
            td3.innerHTML = list3;
         
           
        }
        tr_btn();
    };
}




//城市积水查询
$("#csjs").append('<p class="tb_zzjz" style="text-align: center;">正在加载数据......</p>');
//if ($("#gis_ditu2").length == 0) {$("#allmap").append('<iframe id="gis_ditu2" runat="server" class="ifme" name="gis_ditu2" src="" width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe>');          }        
function csjs_btn() {
    $(".ifme").hide();
    $(".ifme").eq(2).show();
    //$("#gis_ditu2").attr('src', '../prj_js/gis_2.html');
    //$("#csjs").find('.tb_zzjz').remove();
    $.get("../../Home/GetCityJiShui", "", function (data) {
        bindtaba_csjs(data);
        gis_ditu2.window.addlele(data);
    }, "json");
    function bindtaba_csjs(data) {
        $("#csjs").find('.tb_zzjz').remove();
        var div_w = (3 * 100) + gdt;
        $("#csjs").css('width', div_w);
        data = JSON.parse(data);
        var table = document.getElementById("csjs");
        for (var j = table.rows.length - 1; j >= 0; j--) {
            table.deleteRow(j);
        }
        for (var i = 0 ; i < data.length; i++) {
            var list1 = "<div style='width:99px;'>" + data[i].monitoring_point_name + "</div>";
            var list2 = "<div style='width:99px;'>" + data[i].Z.toFixed(2) + "</div>";
            var _c = data[i].flag;
            if (data[i].Z >= 0.1 && data[i].Z<0.27) { list3 = "<div style='width:99px;'><span style='color:#FF7F00;'>注意安全</span></div>" }
            else if (data[i].Z>=0.27) { list3 = "<div style='width:99px;'><span style='color:#FF0000;'>禁止通行</span></div>" }
            else { list3 = "<div style='width:99px;'><span style='color:#09F709;'>正常通行</span></div>" }
            var tr = table.insertRow(table.rows.length);

            var td1 = tr.insertCell(tr.cells.length);
            td1.innerHTML = list1;
            var td2 = tr.insertCell(tr.cells.length);
            td2.innerHTML = list2;
            var td3 = tr.insertCell(tr.cells.length);
            td3.innerHTML = list3;
        }
        tr_btn();
    };
};
//江河水情查询
$("#jhsq").append('<p class="tb_zzjz" style="text-align: center;">正在加载数据......</p>')
//if ($("#gis_ditu3").length == 0) {$("#allmap").append('<iframe id="gis_ditu3" runat="server" class="ifme" name="gis_ditu3" src="" width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe>');          }

function jhsq_btn() {
    $(".ifme").hide();
    $(".ifme").eq(3).show();
    //$("#gis_ditu3").attr('src', '../prj_js/gis_3.html');
    $.get("../../Home/GetJiangheShuiQing", "", function (data) {
        bindtaba_jhsq(data);
        gis_ditu3.window.addlele(data);
    }, "json");
    function bindtaba_jhsq(data) {
        var div_w = (9 * 80) + gdt;
        $("#jhsq").css('width', div_w);
        $("#jhsq").find('.tb_zzjz').remove();
        data = JSON.parse(data);
        var table = document.getElementById("jhsq");
        for (var j = table.rows.length - 1; j >= 0; j--) {
            table.deleteRow(j);
        }
        for (var i = 0 ; i < data.length; i++) {
            var list1 = "<div style='width:80px;'>" + data[i].STNM + "</div>";
            var list2 = "<div style='width:80px;'>" + Number(data[i].Z).toFixed(2) + "</div>";
            var list3 = data[i].Z;
            var list4 = data[i].WRZ;
            var list5 = data[i].FRZ;
            var list6 = data[i].GRZ;
            var list7 = data[i].Q;
            var list8 = data[i].WRQ;
            var list9 = data[i].FRQ;
            var list0 = data[i].GRQ;
            if (list4 == null || list4 == "") {
                list4 = "<div style='width:80px;'></div>"
            } else {
                if (Number(list3) >= Number(list4)) { list4 = "<div style='width:80px;color:#FF7F00;'>预警</div>"; } else { list4 = "<div style='width:80px;color:#09F709;'>正常</div>"; }
            }

            if (list5 == null || list5 == "") {
                list5 = "<div style='width:80px;'></div>"
            } else {
                if (Number(list3) >= Number(list5)) { list5 = "<div style='width:80px;color:#FF7F00;'>预警</div>"; } else { list5 = "<div style='width:80px;color:#09F709;'>正常</div>"; }
            }

            if (list6 == null || list6 == "") {
                list6 = "<div style='width:80px;'></div>"
            } else {
                if (Number(list3) >= Number(list6)) { list6 = "<div style='width:80px;color:#FF7F00;'>预警</div>"; } else { list6 = "<div style='width:80px;color:#09F709;'>正常</div>"; }
            }

            if (list8 == null || list8 == "") {
                list8 = "<div style='width:80px;'></div>"
            } else {
                if (Number(list7) >= Number(list8)) { list8 = "<div style='width:80px;color:#FF7F00;'>预警</div>"; } else { list8 = "<div style='width:80px;color:#09F709;'>正常</div>"; }
            }

            if (list9 == null || list9 == "") {
                list9 = "<div style='width:80px;'></div>"
            } else {
                if (Number(list7) >= Number(list9)) { list9 = "<div style='width:80px;color:#FF7F00;'>预警</div>"; } else { list9 = "<div style='width:80px;color:#09F709;'>正常</div>"; }
            }

            if (list0 == null || list0 == "") {
                list0 = "<div style='width:80px;'></div>"
            } else {
                if (Number(list7) >= Number(list0)) { list0 = "<div style='width:80px;color:#FF7F00;'>预警</div>"; } else { list0 = "<div style='width:80px;color:#09F709;'>正常</div>"; }
            }
            if (list7 == null || list7 == "") { list7 = "<div style='width:80px;'></div>" } else {
                list7 = "<div style='width:80px;'>" + Number(data[i].Q).toFixed(2) + "</div>"
            }
            if (list3 == null || list3 == "") { list3 = "<div style='width:80px;'></div>" } else {
                list3 = "<div style='width:80px;'>" + Number(data[i].Z).toFixed(2) + "</div>"
            }
            var tr = table.insertRow(table.rows.length);

            var td1 = tr.insertCell(tr.cells.length);
            td1.innerHTML = list1;
            var td2 = tr.insertCell(tr.cells.length);
            td2.innerHTML = list3;
            var td4 = tr.insertCell(tr.cells.length);
            td4.innerHTML = list4;
            var td5 = tr.insertCell(tr.cells.length);
            td5.innerHTML = list5;
            var td6 = tr.insertCell(tr.cells.length);
            td6.innerHTML = list6;
            var td7 = tr.insertCell(tr.cells.length);
            td7.innerHTML = list7;
            var td8 = tr.insertCell(tr.cells.length);
            td8.innerHTML = list8;
            var td9 = tr.insertCell(tr.cells.length);
            td9.innerHTML = list9;
            var td0 = tr.insertCell(tr.cells.length);
            td0.innerHTML = list0;
        }
        tr_btn();
    };
};
//水库水情
$("#sksq").append('<p class="tb_zzjz" style="text-align: center;">正在加载数据......</p>')
//if ($("#gis_ditu4").length == 0) {$("#allmap").append('<iframe id="gis_ditu4" runat="server" class="ifme" name="gis_ditu4" src="" width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe>');  }        
function sksq_btn() {
    $(".ifme").hide();
    $(".ifme").eq(4).show();
    //$("#gis_ditu4").attr('src', '../prj_js/gis_4.html');
    $.get("../../Home/GetShuiKuShuiQing", "", function (data) {
        binddata_sksq(data);
        gis_ditu4.window.addlele(data);
    }, "json");
    function binddata_sksq(data) {
        var div_w = (4 * 100) + gdt;
        $("#sksq").css('width', div_w);
        $("#sksq").find('.tb_zzjz').remove();
        data = JSON.parse(data);
        var table = document.getElementById("sksq");
        for (var j = table.rows.length - 1; j >= 0; j--) {
            table.deleteRow(j);
        }
        for (var i = 0 ; i < data.length; i++) {
            var list1 = "<div style='width:99px;'>" + data[i].STNM + "</div>";
            var list2 = data[i].RZ;
            var list3 = data[i].W;
            var list4 = data[i].FSLTDZ;
            if (list2 == null || list2 == "" || list2 == "null") {
                list2 = "";
            }else{
                list2 = Number(data[i].RZ).toFixed(2)
            }
            var list3 = data[i].W;
            if (list3 == null || list3 == "" || list3 == "null") {
                list3 = "";
            }else{
                list3 = Number(data[i].W).toFixed(3)
            }
            var list4 = data[i].FSLTDZ;
            if (list4 == null || list4 == "" || list4 == "null") {
                list4 = "";
            }else{
                list4 = Number(data[i].FSLTDZ).toFixed(2)
            }
            var tr = table.insertRow(table.rows.length);

            var td1 = tr.insertCell(tr.cells.length);
            td1.innerHTML = list1;
            var td2 = tr.insertCell(tr.cells.length);
            td2.innerHTML = list2;
            var td3 = tr.insertCell(tr.cells.length);
            td3.innerHTML = list3;
            var td4 = tr.insertCell(tr.cells.length);
            td4.innerHTML = list4;
        }
        tr_btn();
    }


}





//土壤墒情
$("#trsq").append('<p class="tb_zzjz" style="text-align: center;">正在加载数据......</p>')
//if ($("#gis_ditu5").length == 0) {$("#allmap").append('<iframe id="gis_ditu5" runat="server" class="ifme" name="gis_ditu5" src="" width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe>'); }         

function trsq_btn() {
    $(".ifme").hide();
    $(".ifme").eq(5).show();
    //$("#gis_ditu5").attr('src', '../prj_js/gis_5.html');
    $.get("../../Home/GetTuRangShangQing", "", function (data) {
        binddata_trsq(data);
        gis_ditu5.window.addlele(data);
    }, "json");
    function binddata_trsq(data) {
        var div_w = (2 * 100) + gdt;
        $("#trsq").css('width', div_w);
        $("#trsq").find('.tb_zzjz').remove();
        data = JSON.parse(data);
        var table = document.getElementById("trsq");
        for (var j = table.rows.length - 1; j >= 0; j--) {
            table.deleteRow(j);
        }
        for (var i = 0 ; i < data.length; i++) {
            var list1 = "<div style='width:99px;'>" + data[i].STNM + "</div>";
            var list3 = "<div style='width:99px;'>" + Number(data[i].VTAVSLM).toFixed(1) + "%</div>";
            var tr = table.insertRow(table.rows.length);

            var td1 = tr.insertCell(tr.cells.length);
            td1.innerHTML = list1;
            var td3 = tr.insertCell(tr.cells.length);
            td3.innerHTML = list3;
        }
        tr_btn();
    }

}
//地下埋深
$("#dxms").append('<p class="tb_zzjz" style="text-align: center;">正在加载数据......</p>')
//if ($("#gis_ditu6").length == 0) {$("#allmap").append('<iframe  id="gis_ditu6" runat="server" class="ifme" name="gis_ditu6" src="" width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe>'); }         

function dxms_btn() {
    $(".ifme").hide();
    $(".ifme").eq(6).show();
    //$("#gis_ditu6").attr('src', '../prj_js/gis_6.html');
    $.get("../../Home/GetDiXiaMaiShen", "", function (data) {
        binddata_dxms(data);
        gis_ditu6.window.addlele(data);
    }, "json");
    function binddata_dxms(data) {
        var div_w = (3 * 100) + gdt;
        $("#dxms").css('width', div_w);
        $("#dxms").find('.tb_zzjz').remove();
        data = JSON.parse(data);
        var table = document.getElementById("dxms");
        for (var j = table.rows.length - 1; j >= 0; j--) {
            table.deleteRow(j);
        }
        for (var i = 0 ; i < data.length; i++) {
            var list1 = "<div style='width:99px;'>" + data[i].STNM + "</div>";
            var list2 = data[i].GWBD;
            if (data[i].GWPTN > 5) {
                var list3 = "<div style='width:99px;'>平</div>"
            }
            else if (data[i].GWPTN == 5) {
                var list3 = "<div style='width:99px;'>涨</div>"
            }
            else if (data[i].GWPTN < 5) {
                var list3 = "<div style='width:99px;'>落</div>"
            }
            if (list2 == null || list2 == "") {
                list2 = "<div style='width:99px;'></div>"
            }else{
                list2 = Number(data[i].GWPTN).toFixed(2);
            }
            var tr = table.insertRow(table.rows.length);

            var td1 = tr.insertCell(tr.cells.length);
            td1.innerHTML = list1;
            var td2 = tr.insertCell(tr.cells.length);
            td2.innerHTML = list2;
            var td3 = tr.insertCell(tr.cells.length);
            td3.innerHTML = list3;
        }
        tr_btn();
    }
}




//重要江河水情
$.get("../../Home/GetImportantJiangHeData", "", function (data) {
    binddata_zyjhsq(data);
});
//重要江河水情数据
function binddata_zyjhsq(data) {
    $(".line2").find(".zzjz").remove();
    var jn = "";
    data = eval(data);
    for (i = 0 ; i < data.length; i++) {

        jn = "<li>" + data[i].STNM + data[i].Z.toFixed(2) + "m</li>";
        //jn = "<li>" + data[i].STNM + " 水位 " + data[i].Z.toFixed(2) + "m，流量 " + data[i].Q.toFixed(1) + "m³/s</li>";
        $(".line2").append(jn);
    }
    $('.line2').newsScroll({ className: 'line2', scrollElements: 'li' });
}

//重要水库水情
$.get("../../Home/GetImportantShuiKuData", "", function (data) {
    binddata_zysksq(data);
});
//重要水库水情数据
function binddata_zysksq(data) {
    $(".line3").find(".zzjz").remove();
    var jn = "";
    data = eval(data);
    for (i = 0 ; i < data.length; i++) {
        
        jn = "<li>" + data[i].STNM + data[i].RZ.toFixed(2) + "m" + "</li>";
        //jn += "，库容 " + data[i].W.toFixed(0) + "百万方</li>";
        $(".line3").append(jn);
    }
    $('.line3').newsScroll({ className: 'line3', scrollElements: 'li' });
}

//全市城区积水预警信息
$.get("../../Home/GetCityWaterWarning", "", function (data) {
    binddata_qscqjsyj(data);
});
//全市城区积水预警信息数据绑定
function binddata_qscqjsyj(data) {
    $(".line4").find(".zzjz").remove();
    var simple = "";
    //判断雨量的最大值是否为0，如果是，那么说明全市无雨
    if (data == "[]") {
        simple = "<li>全市无积水</li>";
        $(".line4").append(simple);
    }
    else {
        data = eval(data);
        for (i = 0; i < data.length; i++) {
            simple = "<li>" + data[i].monitoring_point_name + "  " + data[i].value.toFixed(2) + "m  </li>"
            $(".line4").append(simple);

        }
        $('.line4').newsScroll({ className: 'line4', scrollElements: 'li' });
    }
}


//新闻滚动
//$('.line1').newsScroll({ className: 'line1', scrollElements: 'li' });
//$('.line2').newsScroll({ className: 'line2', scrollElements: 'li' });
//$('.line3').newsScroll({ className: 'line3', scrollElements: 'li' });
//$('.line4').newsScroll({ className: 'line4', scrollElements: 'li' });
tr_btn();
function tr_btn() {
    $(".gis_bg_tbe tr:even").addClass("tr_b");
    $(".gis_bg_tbe tr:odd").addClass("tr_b1");
    $(".gis_bg_tbe tr").on('click', function () {

        var a = $(this).attr("class").length;
        if (a > 7) { $(this).removeClass("tr_b_on"); }
        else {
            $(this).addClass("tr_b_on");
            $(this).prevAll().removeClass("tr_b_on");
            $(this).nextAll().removeClass("tr_b_on");
        }
    });
    csjs_td_btn();//点击获取TD 
    cshd_td_btn();//点击获取TD 
    jhsq_td_btn();//点击获取TD 
    sksq_td_btn();//点击获取TD 
    trsq_td_btn();//点击获取TD 
    dxms_td_btn();//点击获取TD     
}
tr_btn2();
function tr_btn2() {
    qspjxq_td_btn();
    qspjxq_td_btn2();
    $(".qspjjylxq_tab tr").on('click', function () {

        var a = $(this).attr("class").length;
        if (a > 7) { $(this).removeClass("tr_b_on"); }
        else {
            $(this).addClass("tr_b_on");
            $(this).prevAll().removeClass("tr_b_on");
            $(this).nextAll().removeClass("tr_b_on");
            $(this).parent().parent().prevAll().find('tr').removeClass("tr_b_on");
            $(this).parent().parent().nextAll().find('tr').removeClass("tr_b_on");
        }
    });
    $("#qspjjyl tr").on('click', function () {
            $(this).addClass("tr_b_on");
            $(this).prevAll().removeClass("tr_b_on");
            $(this).nextAll().removeClass("tr_b_on");
        
    });
}

//取重复数组中的不同数
function uniqueArray(a) {
    temp = new Array();
    for (var i = 0; i < a.length; i++) {
        if (!contains(temp, a[i])) {
            temp.length += 1;
            temp[temp.length - 1] = a[i];
        }
    }
    return temp;
}
function contains(a, e) {
    for (j = 0; j < a.length; j++) if (a[j] == e) return true;
    return false;
}

function szsjxx_nav_btn1() {
    $(".gis_bg_index").css('width', '600px');
}
function szsjxx_nav_btn2() {
    $(".gis_bg_index").css('width', '217px');
}
//全市平均降雨量
$.get("../../Home/GetYiChangRain", "", function (data) {
    binddata_pjjyl(data);
});
//平均雨量数据绑定
function binddata_pjjyl(data) {
    $(".line1").find(".zzjz").remove();
    var simple = "";
    //判断雨量的最大值是否为0，如果是，那么说明全市无雨
    if (Number(data.max) == 0) {
        simple = "<li>全市无雨</li>";
    }
    else {
        if (data.average >= 0 && data.average < 0.1) {
            simple = "<li>零星小雨</li>";
        } else {
            data.average = data.average.toFixed(1);
            simple = "<li>" + data.average+ "mm</li>" +
                 "<li>最大:" + data.maxsite + data.max.toFixed(1) + "mm</li>";
        }
    }
    $("#rain").append(simple);
    $('.line1').newsScroll({ className: 'line1', scrollElements: 'li' });
}
//点击获取tr第一个TD
function qspjxq_td_btn() {
    $(".qspjjylxq_tab td").on('click', function () {
        var di = $(this).parent().find('td').eq(0).html();
        gis_ditu0.window.allPoint(di);
    });
}
//详情点击获取tr第一个TD
function qspjxq_td_btn2() {
    $("#qspjjyl td").on('click', function () {
        var di = $(this).parent().find('td').eq(0).html();
        gis_ditu0.window.allPoint2(di);
    });
}
//城市积水点击获取tr第一个TD
function csjs_td_btn() {
    $("#csjs td").on('click', function () {
        var di = $(this).parent().find('td').eq(0).find('div').html();

        gis_ditu2.window.allPoint(di);
    });
    // body... 
}
//城市河道点击获取tr第一个TD
function cshd_td_btn() {
    $("#cshd td").on('click', function () {
        var di = $(this).parent().find('td').eq(0).find('div').html();

        gis_ditu1.window.allPoint(di);
    });
    // body... 
}
//江河水情点击获取tr第一个TD
function jhsq_td_btn() {
    $("#jhsq td").on('click', function () {
        var di = $(this).parent().find('td').eq(0).find('div').html();

        gis_ditu3.window.allPoint(di);
    });
    // body... 
}
//水库水情点击获取tr第一个TD
function sksq_td_btn() {
    $("#sksq td").on('click', function () {
        var di = $(this).parent().find('td').eq(0).find('div').html();

        gis_ditu4.window.allPoint(di);
    });
    // body... 
}
//土壤点击获取tr第一个TD
function trsq_td_btn() {
    $("#trsq td").on('click', function () {
        var di = $(this).parent().find('td').eq(0).find('div').html();

        gis_ditu5.window.allPoint(di);
    });
    // body... 
}
//地下点击获取tr第一个TD
function dxms_td_btn() {
    $("#dxms td").on('click', function () {
        var di = $(this).parent().find('td').eq(0).find('div').html();

        gis_ditu6.window.allPoint(di);
    });
    // body... 
}
function tb_box() {

    var tb0 = "";
    var tb1 = "";
    var tb0_name = "";

    for (var i = 0; i < 12; i++) {
        var ii = i + 1;
        var tb0 = $(".qspjjyl_xq"+ i +" tr");
        var tb1 = $(".qspjjyl_xq"+ ii +" tr");
        var tb0_name = tb0;
        box_box(tb0_name, tb0, tb1);
    }


}
function box_box(name,a, b) {
    var a = a.length;
    var b = b.length;
    var n = "";
    if (a > b) {
        var v = a - b;
        for (var i = 0; i < v; i++) {
            name.eq(b).css("border-right", "1px solid #000")
            name.eq(b).css("width", "200px")
            b++;
        }
    }
}